import * as PIXI from 'pixi.js'
import { useWindowSize } from '@vueuse/core'
import { setPixi } from '@/store/modules/usePixiStore'
import { modalClick } from '@/utils/events'
import useMainStore from '@/store/modules/useMainStore'
import btnDownload from './btnDownload'
const { width, height } = useWindowSize()

export default async () => {
  const mainStore = useMainStore()
  const modalRect = new PIXI.Graphics()
  const { scale } = mainStore.getAppAttr
  modalRect.rect(0, 0, width.value / scale, height.value / scale).fill({
    color: 0x000000,
    alpha: 0.7,
  })
  const container = new PIXI.Container({ visible: false })
  container.addChild(modalRect)
  setPixi('modal', container)
  modalClick.whiteAdd(container)

  // 添加下载按钮
  const btnSprite = await btnDownload()
  container.addChild(btnSprite)
  return container
}
